<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    /*
        经常用,但是特殊情况还是提一下
     */
    
    // 1
    function makeKing(firstName = 'jack',lastName = firstName) {
        return `${firstName}-${lastName}`
    }

    console.log(makeKing()) // jack-jack
    console.log(makeKing('tom'))  // tom-tom
    
    // 2.前面的参数不能引用后面的参数
    function fn(firstName = lastName,lastName = 'jack') {
        return `${firstName}-${lastName}`
    }

    // console.log(fn()) // 报错
    console.log(fn('john')) // john-jack
    
</script>
</body>
</html>